﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ScreenProtector
{
    public partial class FrmInput : Form
    {
        /// <summary>
        /// 获取文本框的值
        /// </summary>
        public string GetInputString
        {
            get
            {
                return txtInput.Text;
            }
        }
        public FrmInput()
        {
            InitializeComponent();
        }

        private void FrmInput_Load(object sender, EventArgs e)
        {
            this.txtInput.Text = "";
        }

        private void txtInput_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.Hide();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.txtInput.Text = "";
                this.Hide();
            }
        }

        private void FrmInput_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = false;
            txtInput_KeyDown(null, new KeyEventArgs(Keys.Escape));
        }
    }
}
